<%--
  Created by IntelliJ IDEA.
  User: 李元峰
  Date: 2022/10/22
  Time: 14:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>

<!doctype html>
<html lang="en" class="pxp-root">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600;700&display=swap" rel="stylesheet">
    <link href="/static/web/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.carousel.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.theme.default.min.css">
    <link rel="stylesheet" href="/static/web/css/animate.css">
    <link rel="stylesheet" href="/static/web/css/style.css">
    <!-- 配置文件 -->
    <script type="text/javascript" src="/static/ueditor-utf8/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/static/ueditor-utf8/ueditor.all.js"></script>

    <title>企业-企业信息</title>
</head>
<body style="background-color: var(--pxpMainColorLight);">
<div class="pxp-preloader"><span>Loading...</span></div>

<jsp:include page="/web/companies/inc/companyHead"/>

    <div class="pxp-dashboard-content-details">
        <h1>编辑公司信息</h1>
        <p class="pxp-text-light">详细编辑一下自己公司的信息吧</p>

        <form action="/web/companies/saveCompanyInfo" id="myform" method="post" enctype="multipart/form-data">
            <div class="row mt-4 mt-lg-5">
                <div class="col-xxl-8">
                    <div class="mb-3">
                        <label for="pxp-company-name" class="form-label">企业名称</label><span id="company-name-msg" style="color: red;"></span>
                        <input type="text" id="pxp-company-name" class="form-control" placeholder="编辑企业名称" name="name" value="${requestScope.company.name}">
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-company-email" class="form-label">Email</label><span id="company-email-msg" style="color: red;"></span>
                                <input type="email" id="pxp-company-email" class="form-control" placeholder="编辑企业邮箱" name="email" value="${requestScope.company.email}">
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-company-phone" class="form-label">电话号码</label><span id="company-phone-msg" style="color: red;"></span>
                                <input type="tel" id="pxp-company-phone" class="form-control" placeholder="输入企业电话号码" name="phone" value="${requestScope.company.phone}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-company-post" class="form-label">邮编</label><span id="company-post-msg" style="color: red;"></span>
                                <input type="text" id="pxp-company-post" class="form-control" placeholder="输入企业所在地邮编" name="postcode" value="${requestScope.company.postcode}">
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-company-contact" class="form-label">联系人</label><span id="company-contact-msg" style="color: red;"></span>
                                <input type="text" id="pxp-company-contact" class="form-control" placeholder="请输入联系人姓名" name="contactPerson" value="${requestScope.company.contactPerson}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-4">
                    <div class="form-label">&nbsp;</div>
                    <div class="pxp-company-cover mb-3"><span id="company-face-msg" style="color: red;"></span>
                        <input type="file" id="pxp-company-cover-choose-file" accept="image/*" name="facePic">
                        <label for="pxp-company-cover-choose-file" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.company.face})"><span>上传封面照片</span></label>
                    </div>
                    <div class="pxp-company-logo mb-3"><span id="company-logo-msg" style="color: red;"></span>
                        <input type="file" id="pxp-company-logo-choose-file" accept="image/*" name="logoPic">
                        <label for="pxp-company-logo-choose-file" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.company.companyLogo})"><span>上传<br>企业Logo</span></label>
                    </div>
                </div>
            </div>

            <div class="mb-3">
                <label for="info" class="form-label">关于公司的详情</label><span id="info-msg" style="color: red;"></span>
                <script id="info" name="introduction"><c:if test="${requestScope.company.introduction==null}" var="nullInfo">公司详细资料</c:if><c:if test="${not nullInfo}">${requestScope.company.introduction}</c:if></script>
            </div>

            <div class="pxp-company-pics mb-3">
                <span id="company-pic1" style="color: red;"></span>
                <input type="file" id="pic1" accept="image/*" name="pics" class="companyPics">
                <label for="pic1" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.companyPics[0].pic})"><span>上传公司环境照片1</span></label>
                <img id="aaa">
                <span id="company-pic2" style="color: red;"></span>
                <input type="file" id="pic2" accept="image/*" name="pics" class="companyPics">
                <label for="pic2" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.companyPics[1].pic})"><span>上传公司环境照片2</span></label>
                <span id="company-pic3" style="color: red;"></span>
                <input type="file" id="pic3" accept="image/*" name="pics" class="companyPics">
                <label for="pic3" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.companyPics[2].pic})"><span>上传公司环境照片3</span></label>
                <span id="company-pic4" style="color: red;"></span>
                <input type="file" id="pic4" accept="image/*" name="pics" class="companyPics">
                <label for="pic4" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.companyPics[3].pic})"><span>上传公司环境照片4</span></label>
                <span id="company-pic5" style="color: red;"></span>
                <input type="file" id="pic5" accept="image/*" name="pics" class="companyPics">
                <label for="pic5" class="pxp-cover" style="background-image: url(/static/uploadImages/${requestScope.companyPics[4].pic})"><span>上传公司环境照片5</span></label>
            </div>
<%--            <div class="pxp-company-cover mb-3"><span id="company-pic2" style="color: red;"></span>--%>

<%--            </div>--%>

<%--            <div class="row" style="margin-top: 30px;">--%>
<%--                <h2>公司认证信息</h2>--%>
<%--                <p class="pxp-text-light">编辑此信息时要慎重，后台管理员会进行企业认证，认证失败将取消用户资格</p>--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-date" class="form-label">注册日期</label>--%>
<%--                        <input type="date" id="pxp-company-date" class="form-control" name="enrollTime">--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-legal" class="form-label">法人代表</label>--%>
<%--                        <input type="text" id="pxp-company-legal" class="form-control" placeholder="请输入法人代表" name="legalRepresentative">--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-capital" class="form-label">注册资本</label>--%>
<%--                        <input type="text" id="pxp-company-capital" class="form-control" placeholder="请输入企业的注册资本" name="registeredCaptial"/>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--            <div class="row">--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-size" class="form-label">公司规模</label>--%>
<%--                        <select id="pxp-company-size" class="form-select" name="companySizeId">--%>
<%--                            <option selected disabled hidden value="0">请选择</option>--%>
<%--                        </select>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-nature" class="form-label">公司性质</label>--%>
<%--                        <select id="pxp-company-nature" class="form-select" name="companyNatureId">--%>
<%--                            <option selected disabled hidden value="0">请选择</option>--%>
<%--                        </select>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-create" class="form-label">企业成立日期</label>--%>
<%--                        <input type="date" id="pxp-company-create" class="form-control" name="creationDate">--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>
<%--            <div class="row">--%>
<%--                <div class="col-md-4">--%>
<%--                    <div class="mb-3">--%>
<%--                        <label for="pxp-company-position" class="form-label">公司类型</label>--%>
<%--                        <select id="pxp-company-position" class="form-select" name="positionTypeId">--%>
<%--                            <option selected disabled hidden value="0">请选择</option>--%>
<%--                        </select>--%>
<%--                    </div>--%>
<%--                </div>--%>
<%--            </div>--%>

            <div class="mt-4 mt-lg-5">
                <h2>公司位置</h2>
                <div class="row">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-company-prov" class="form-label">企业所在省</label>
                            <select id="pxp-company-prov" class="form-select" name="provinceId">
                                <c:forEach items="${requestScope.provinces}" var="province">
                                    <option value="${province.provId}">${province.provName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-company-city" class="form-label">企业所在市</label>
                            <select id="pxp-company-city" class="form-select" name="cityId">
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-company-district" class="form-label">企业所在区</label>
                            <select type="text" id="pxp-company-district" class="form-select" name="districtId">
                            </select>
                        </div>
                    </div>
                </div>
                <div class="mb-3">
                    <label for="pxp-company-address" class="form-label">详细地址</label><span id="company-address-msg" style="color: red;"></span>
                    <input type="text" id="pxp-company-address" class="form-control" placeholder="请在此输入企业详细地址" name="address" value="${requestScope.company.address}">
                </div>
            </div>
            <div class="mt-4 mt-lg-5">
                <button class="btn rounded-pill pxp-section-cta" id="submitButton" type="button">保存信息</button>
            </div>
        </form>
    </div>

<jsp:include page="/web/companies/inc/companyFoot"/>

</div>

<script src="/static/web/js/jquery-3.4.1.min.js"></script>
<script src="/static/web/js/bootstrap.bundle.min.js"></script>
<script src="/static/web/js/owl.carousel.min.js"></script>
<script src="/static/web/js/nav.js"></script>
<script src="/static/web/js/Chart.min.js"></script>
<script src="/static/web/js/main.js"></script>
</body>
</html>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    var items = {
        initialFrameHeight : 600,
        toolbars:[['source','|','undo','redo','|','bold','italic','|','subscript','superscript','horizontal','|','indent','|','fontsize','|','searchreplace','|','justifycenter','justifyleft','justifyright','|','preview']]
    };
    var ue = UE.getEditor('info',items);

    $(function (){
        init();
        $("#pxp-company-name").blur(checkName);
        $("#pxp-company-email").blur(checkEmail);
        $("#pxp-company-phone").blur(checkPhone);
        $("#pxp-company-post").blur(checkPost);
        $("#pxp-company-contact").blur(checkContact);
        $("#pxp-company-prov").click(changeCityByProv);
        $("#pxp-company-city").click(changeDistrictByCity);
        $("#pxp-company-address").blur(checkAddress);
        $("#pxp-company-cover-choose-file").change(checkFace);
        $("#pxp-company-logo-choose-file").change(checkLogo);
        $("#submitButton").click(submitForm);
        $("#pic1").change(checkPic1);
        $("#pic2").change(checkPic2);
        $("#pic3").change(checkPic3);
        $("#pic4").change(checkPic4);
        $("#pic5").change(checkPic5);

    });


    function checkPic1()
    {

        let picVal=$("#pic1").val();
        let pic = $("#pic1").get(0).files[0];
        if (picVal==""&&$("#pic1+label").css("background-image")!="url(\"http://localhost:8080/static/uploadImages/\")")
        {
            return true;
        }
        if(picVal=="")
        {
            $("#company-pic1").html("请选择图片");
            return false;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = picVal.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-pic1").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = picVal.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-pic1").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        if (pic.size>1024*1024*2)
        {
            $("#company-pic1").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-pic1").html("");
        let reader = new FileReader();
        reader.readAsDataURL(pic);
        reader.onload=()=>{
            $("#pic1+label").css("background-image","url("+reader.result+")");
            $("#pic1+label>span").css("display","none");
        }
        return true;
    }
    function checkPic2()
    {


        let picVal=$("#pic2").val();
        let pic = $("#pic2").get(0).files[0];
        if (picVal==""&&$("#pic2+label").css("background-image")!="url(\"http://localhost:8080/static/uploadImages/\")")
        {
            return true;
        }
        if(picVal=="")
        {
            $("#company-pic2").html("请选择图片");
            return false;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = picVal.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-pic2").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = picVal.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-pic2").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        if (pic.size>1024*1024*2)
        {
            $("#company-pic2").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-pic2").html("");
        let reader = new FileReader();
        reader.readAsDataURL(pic);
        reader.onload=()=>{
            $("#pic2+label").css("background-image","url("+reader.result+")");
            $("#pic2+label>span").css("display","none");
        }
        return true;
    }
    function checkPic3()
    {

        let picVal=$("#pic3").val();
        let pic = $("#pic3").get(0).files[0];
        if (picVal==""&&$("#pic3+label").css("background-image")!="url(\"http://localhost:8080/static/uploadImages/\")")
        {
            return true;
        }
        if(picVal=="")
        {
            $("#company-pic3").html("请选择图片");
            return false;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = picVal.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-pic3").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = picVal.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-pic3").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        if (pic.size>1024*1024*2)
        {
            $("#company-pic3").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-pic3").html("");
        let reader = new FileReader();
        reader.readAsDataURL(pic);
        reader.onload=()=>{
            $("#pic3+label").css("background-image","url("+reader.result+")");
            $("#pic3+label>span").css("display","none");
        }
        return true;
    }
    function checkPic4()
    {

        let picVal=$("#pic4").val();
        let pic = $("#pic4").get(0).files[0];
        if (picVal==""&&$("#pic4+label").css("background-image")!="url(\"http://localhost:8080/static/uploadImages/\")")
        {
            return true;
        }
        if(picVal=="")
        {
            $("#company-pic4").html("请选择图片");
            return false;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = picVal.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-pic4").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = picVal.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-pic4").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        if (pic.size>1024*1024*2)
        {
            $("#company-pic4").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-pic4").html("");
        let reader = new FileReader();
        reader.readAsDataURL(pic);
        reader.onload=()=>{
            $("#pic4+label").css("background-image","url("+reader.result+")");
            $("#pic4+label>span").css("display","none");
        }
        return true;
    }
    function checkPic5()
    {

        let picVal=$("#pic5").val();
        let pic = $("#pic5").get(0).files[0];
        if (picVal==""&&$("#pic5+label").css("background-image")!="url(\"http://localhost:8080/static/uploadImages/\")")
        {
            return true;
        }
        if(picVal=="")
        {
            $("#company-pic5").html("请选择图片");
            return false;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = picVal.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-pic5").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = picVal.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-pic5").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        if (pic.size>1024*1024*2)
        {
            $("#company-pic5").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-pic5").html("");
        let reader = new FileReader();
        reader.readAsDataURL(pic);
        reader.onload=()=>{
            $("#pic5+label").css("background-image","url("+reader.result+")");
            $("#pic5+label>span").css("display","none");
        }
        return true;
    }
    function submitForm()
    {
        if (checkName()&&checkInfo()&&checkPhone()&&checkContact()&&checkAddress()&&checkFace()&&checkLogo()&&checkPost()&&checkEmail()&&checkPic1()&&checkPic2()&&checkPic3()&&checkPic4()&&checkPic5())
        {
            $("#myform").submit();
        }
    }

    function checkInfo()
    {
        let info = ue.getContentTxt();
        if (info==""||info==null)
        {
            $("#info-msg").html("*必填");
            return false;
        }
        let zheng = /^.{10,2000}$/;
        if (!zheng.test(info))
        {
            $("#info-msg").html("描述至少10个字");
            return false;
        }
        $("#info-msg").html("");
        return true;
    }


    function checkFace()
    {
        let face = $("#pxp-company-cover-choose-file").val();
        if(face=="")
        {
            return true;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = face.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-face-msg").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = face.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-face-msg").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let file = $("#pxp-company-cover-choose-file").get(0).files[0];
        if (file.size>1024*1024*2)
        {
            $("#company-face-msg").html("图片过大，不能超过2M");
            return false;
        }
        $("#company-face-msg").html("");
        return true;

    }

    function checkLogo()
    {
        let logo = $("#pxp-company-logo-choose-file").val();
        if(logo=="")
        {
            return true;
        }
        let doc = "jpg,png,jpeg,gif,webp"
        let faceDocIndex  = logo.lastIndexOf(".");
        if (faceDocIndex==-1)
        {
            $("#company-logo-msg").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let faceExe = logo.substring(faceDocIndex+1);
        if (!(","+doc+",").includes(","+faceExe+","))
        {
            $("#company-logo-msg").html("图片格式有误，应为("+doc+")格式的图片");
            return false;
        }
        let file = $("#pxp-company-logo-choose-file").get(0).files[0];
        if (file.size>1024*500)
        {
            $("#company-logo-msg").html("图片过大，不能超过500k");
            return false;
        }
        $("#company-logo-msg").html("");
        return true;

    }

    function init()
    {
        let companyProvId = "${requestScope.company.provinceId}";
        let companyCityId = "${requestScope.company.cityId}";
        let companyDistrictId = "${requestScope.company.districtId}";
        if (companyProvId!="")
        {
            $("#pxp-company-prov").find("option[value='"+companyProvId+"']").prop("selected",true);
            changeCityByProv();
            if (companyCityId!="")
            {
                $("#pxp-company-city").find("option[value='"+companyCityId+"']").prop("selected",true);
                changeDistrictByCity();
                if (companyDistrictId!="")
                {
                    $("#pxp-company-district").find("option[value='"+companyDistrictId+"']").prop("selected",true);
                }
            }

        }
        else {
            changeCityByProv();
        }
        let success="${param.success}";
        if(success!="")
        {
            alert("保存成功");
        }
    }
    function changeCityByProv()
    {
        let provId = $("#pxp-company-prov").val();
        $.ajax({
            url:"/web/changeCityByProvId",
            type:"post",
            data:{
                provId:provId
            },
            dataType:"json",
            async:false,
            success:function (mes)
            {
                $("#pxp-company-city").html("");
                for (let i = 0; i < mes.length; i++) {
                    $("#pxp-company-city").append("<option value='"+mes[i].cityId+"'>"+mes[i].cityName+"</option>");
                }
            }
        });
        changeDistrictByCity();
    }

    function changeDistrictByCity()
    {
        let cityId = $("#pxp-company-city").val();
        $.ajax({
            url:"/web/changeDistrictByCityId",
            type:"post",
            data:{
                cityId:cityId
            },
            dataType:"json",
            async:false,
            success:function (mes)
            {
                $("#pxp-company-district").html("");
                for (let i = 0; i < mes.length; i++) {
                    $("#pxp-company-district").append("<option value='"+mes[i].id+"'>"+mes[i].districtName+"</option>");
                }
            }
        });
    }

    function checkName()
    {
        let name = $("#pxp-company-name").val();
        if (name==""||name==null)
        {
            $("#company-name-msg").html("*必填");
            return false;
        }
        let zheng = /^.{3,20}$/;
        if (!zheng.test(name))
        {
            $("#company-name-msg").html("公司名称格式有误");
            return false;
        }
        $("#company-name-msg").html("");
        return true;
    }

    function checkEmail()
    {
        let email = $("#pxp-company-email").val();
        if (email==""||email==null)
        {
            $("#company-email-msg").html("*必填");
            return false;
        }
        let zheng = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
        if (!zheng.test(email)){
            $("#company-email-msg").html("邮箱格式有误");
            return false;
        }
        $("#company-email-msg").html("");
        return true;
    }

    function checkPhone()
    {
        let phone = $("#pxp-company-phone").val();
        if (phone==""||phone==null)
        {
            $("#company-phone-msg").html("*必填");
            return false;
        }
        let zheng = /^1[0-9]{10}$/;
        if (!zheng.test(phone))
        {
            $("#company-phone-msg").html("手机号码格式有误");
            return false;
        }
        $("#company-phone-msg").html("");
        return true;
    }

    function checkPost()
    {
        let post = $("#pxp-company-post").val();
        if (post==""||post==null)
        {
            $("#company-post-msg").html("*必填");
            return false;
        }
        let zheng = /^[0-9]{6}$/;
        if (!zheng.test(post))
        {
            $("#company-post-msg").html("邮编格式有误");
            return false;
        }
        $("#company-post-msg").html("");
        return true;
    }

    function checkContact()
    {
        let contact = $("#pxp-company-contact").val();
        if (contact==""||contact==null)
        {
            $("#company-contact-msg").html("*必填");
            return false;
        }
        let zheng = /^.{2,10}$/;
        if (!zheng.test(contact))
        {
            $("#company-contact-msg").html("联系人格式有误");
            return false;
        }
        $("#company-contact-msg").html("");
        return true;
    }

    function checkAddress()
    {
        let address = $("#pxp-company-address").val();
        if (address==""||address==null)
        {
            $("#company-address-msg").html("*必填");
            return false;
        }
        let zheng = /^.{5,100}$/;
        if (!zheng.test(address))
        {
            $("#company-address-msg").html("联系人格式有误");
            return false;
        }
        $("#company-address-msg").html("");
        return true;
    }


</script>
